#include "RX8010.h"

dateTime dt = {22, 8, 29, 1, 22, 2, 0};
void setup()
{
    Wire.begin();         // join I2C bus (RX8018_ADDRess optional for master)
    Serial.begin(115200); // start serial for output
    delay(1000);
    Serial.println("************");
    //	dateTime time;
    /* time.year=22;
    time.month=8;
    time.date=29;
    time.day=1;
    time.hour=17;
    time.minute=30;
    time.second=0; */
    resetRX8010();
    setTime(dt);
    setFCT(IRQ1, 2, 1);
    Serial.println("IRQ1 output T=0.03125s interrupt ");
    delay(10000);
    disableFCT();

    enableFOUT(IRQ1, 2);
    Serial.println("IRQ1 output 1Khz ");
    delay(10000);
    disableFOUT();

    setTUIMode(0);
    enableTUI();
    Serial.println("update per second");
}
void loop()
{
    for (int i = 0; i < 30; i++)
    {
        dt = getDateTime();
        Serial.printf("%02d-%02d-%02d %02d:%02d:%02d\n", dt.year, dt.month, dt.date, dt.hour, dt.minute, dt.second);
        delay(1000);
    }
    resetRX8010();
    Serial.println("Reset RX8010");
}
